<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>AngularJS-路由</title>
		<script src="src/js/lib/underscore/underscore-min.js" type="text/javascript" charset="utf-8"></script>
		<script src="src/js/lib/jquery/dist/jquery.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="src/js/lib/angular/angular.min.js" type="text/javascript" charset="utf-8"></script>
		<!--网址：http://code.angularjs.org-->
		<script src="src/js/lib/angular/angular-route.min.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body ng-app="wbcApp">
		
		<div class="nav">
			<a href="#/">首页</a>
			<a href="#/users">用户管理</a>
			<a href="#/asset">资产管理</a>
		</div>
		
		<hr />
		
		<div ng-view></div>
		
		<script>
		
			var wbcApp = angular.module('wbcApp',['ngRoute'])
				.config(['$routeProvider', function($routeProvider){
					$routeProvider
						.when('/', {templateUrl: 'src/views/index.html', controller: 'indexController'})
						.when('/users', {templateUrl: 'src/views/users.html', controller: 'usersController'})
						.when('/asset', {templateUrl: 'src/views/asset.html', controller: 'assetController'})
						.otherwise({redirectTo: '/'});
				}]);
		
			wbcApp.controller('indexController', function(){
				console.log('index');
			});
			wbcApp.controller('usersController', function(){
				console.log('users');
			});
			wbcApp.controller('assetController', function(){
				console.log('asset');
			});
		
			/*angular.module('wbcApp',['ngRoute'])
				.config(['$routeProvider', function($routeProvider){
					$routeProvider
						.when('/', {template: '这是首页'})
						.when('/users', {template: '这是用户管理页'})
						.when('/asset', {template: '<h1>这是资产管理页</h1>'})
						.otherwise({redirectTo: '/'});
				}]);*/
		</script>
		
	</body>
</html>
